package com.godtree.properties;

import lombok.Data;
import lombok.Getter;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author lisicheng
 * @date 20220726
 */
@ConfigurationProperties("mail")
@Component
@Getter
public class MailProperties implements InitializingBean {

  private static MailProperties mailProperties;

  @Value("to")
  List<String> to;

  @Override
  public void afterPropertiesSet() throws Exception {
    mailProperties = this;
  }

  public static MailProperties getMailProperties() {
    return mailProperties;
  }
}
